import request from '@/utils/request'

export function login(username, password) {
  return request({
    url: '/backstage/users/login',
    method: 'post',
    data: {
      username,
      password
    }
  })
}

export function register(phone, verificationCode) {
  return request({
    url: '/backstage/smsLogin',
    method: 'post',
    data: {
      phone,
      verificationCode
    }
  })
}

export function sendSMS(phone) {
  return request({
    url: '/backstage/sendSMS?phone='+phone,
    method: 'get',
  })
}
export function getInfo(username) {
  return request({
    url: `/backstage/userinfo/${username}`,
    method: 'get',
  })
}

export function logout() {
  return request({
    url: '/user/logout',
    method: 'post'
  })
}
